package com.currentcms.client.event;

import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.user.client.ui.Widget;

public class ToggleEvent extends GwtEvent<ToggleHandler>
{

	private static Type<ToggleHandler> TYPE;

	public static Type<ToggleHandler> getType()
	{
		if (TYPE == null)
		{
			TYPE = new Type<ToggleHandler>();
		}
		return TYPE;
	}

	private Widget _source;

	public ToggleEvent(Widget source)
	{
		_source = source;
	}

	public Widget getSource()
	{
		return _source;
	}

	@Override
	public final Type<ToggleHandler> getAssociatedType()
	{
		return TYPE;
	}

	@Override
	public String toDebugString()
	{
		assertLive();
		return super.toDebugString();
	}

	@Override
	protected void dispatch(ToggleHandler handler)
	{
		handler.onToggleEvent(this);
	}
}
